package com.example.volleyball.playcharting.android;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

public class VballCourt extends View{

	private Canvas c;
	private Path path = new Path();
//	private Point l = new Point(0,0);
	
	
	
	
	public VballCourt(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
	}
	public VballCourt(Context context){
		
		super(context);
	}
	
	private void init(){
		
	}
	protected void onDraw(Canvas canvas){

		super.onDraw(canvas);
		Paint p= new Paint();
		p.setColor(Color.BLACK);
		//canvas.drawCircle(50, 50, 10, p);
		//canvas.drawLine(0, 0, getRight(), 0, p);
		p.setStyle(Style.STROKE);
		p.setStrokeWidth(4);
		int scale = 18;
		int left = (getRight()- (scale*60))/2;
		int right = getRight()-left;
		int bottom = 10+ (scale*30);
		//canvas.drawRect(left, 10, right, bottom, p);
		p.setStrokeWidth(0);
		p.setColor(Color.RED);
		
		canvas.drawLine(0, bottom+10, getRight(), bottom+10, p);
		int middlex = left+(right-left)/2;
		p.setColor(Color.BLACK);
		p.setStrokeWidth(6);
		canvas.drawLine(middlex, 10, middlex, bottom, p);
		p.setColor(Color.GRAY);
		p.setStrokeWidth(2);
		/*
		for(int i = 1; i<3; i++){

			int vert = (middlex-left)/2;
			canvas.drawLine((i*vert)+left, 10, (i*vert)+left, bottom, p);
			canvas.drawLine(left, 10+ (i*(bottom-10)/3), right, 10+ (i*(bottom-10)/3), p);
			int j= i+2;
			canvas.drawLine((j*vert)+left, 10, (j*vert)+left, bottom, p);

		}
		*/
		path.addCircle(10, 10, 10, Path.Direction.CCW);
		canvas.drawPath(path, p);
		c = canvas;

	}
	/*
    @Override
	public boolean onTouchEvent(MotionEvent event) {
    	//Canvas can = new Canvas();
    	
    	//Toast.makeText(getContext(), "hi", Toast.LENGTH_SHORT);
    	//c.drawLine(30, 30,50, 50, new Paint());
    	if(event.getAction() == MotionEvent.ACTION_DOWN)
    		//path.addCircle(event.getX(), event.getY(), 10, Path.Direction.CCW);
    	//path.moveTo(event.getX(), event.getY());
    	//c.drawPath(path, new Paint());
    		c.drawLine(0, 0, 50, 50, new Paint());
	    //return super.onTouchEvent(event);
    	return true;
	}
	*/


}
